const bookList = [
  {
    name: "Java 从入门到放弃",
    desc: "远离Java编程",
    url: "http://www.example.com/books/x001"
  },
  {
    name: "MySql 从入门到删库",
    desc: "远离MySql编程",
    url: "http://www.example.com/books/x002"
  },
  {
    name: "C# 从入门到入土",
    desc: "远离C#编程",
    url: "http://www.example.com/books/x003"
  },
  {
    name: "Python 从入门到放弃",
    desc: "远离Python编程",
    url: "http://www.example.com/books/x004"
  },
  {
    name: "ES 从入门到删库",
    desc: "远离ES编程",
    url: "http://www.example.com/books/x005"
  },
  {
    name: "List 从入门到入土",
    desc: "远离Lisp编程",
    url: "http://www.example.com/books/x006"
  }
];

const chartData = {
  result: [
    { genre: "淘宝", sold: 275 },
    { genre: "京东", sold: 1150 },
    { genre: "天猫", sold: 120 },
    { genre: "亚马逊", sold: 350 },
    { genre: "当当", sold: 150 }
  ],
  title: "销售情况表"
};
export default {
  "get /dev/bookList": function(req, res) {
    setTimeout(() => {
      let books = bookList;
      //to do
      res.json(books);
    }, 25);
  },
  "get /dev/bookList_e": function(req, res) {
    res.status(500);
    res.json({});
  },
  "get /dev/chartData": function(req, res) {
    chartData.result[0].map = e => (e.sold = Math.floor(Math.random() * 1000));
    res.json(chartData);
  }
};
